;; math/gain.scm - (c) rohan drape, 2000-2005

;; Convert a linear rms gain value to a decibel value and the inverse.
;; Zero decibels is unity gain.  These algorithms are from SC3.

(define (rms-to-db rms) (* (log10 rms) 20))
(define (db-to-rms db)  (expt 10 (* db 0.05)))
(define (pow-to-db pow) (* (log10 pow) 10))
(define (db-to-pow db)  (expt 10 (* db 0.1)))
